package com.darren.archive.task;



import com.darren.archive.websocket.MessageNotificationWebSocket;
import  lombok.extern.slf4j.Slf4j;
import  org.springframework.scheduling.annotation.Async;
import  org.springframework.scheduling.annotation.EnableScheduling;
import  org.springframework.scheduling.annotation.Scheduled;
import  org.springframework.stereotype.Component;

@Component
@Slf4j
@EnableScheduling//启用定时任务
public  class   SystemParametersJob{

    @Async  //@Async 并行执行（异步的），如果想串行执行无需添加
    @Scheduled(cron="0 0/1 * * * ?")//到整分钟数时执行
    public  void  timerJobTest(){
        try{
            log.info("System parameters job launch total  time... "+System.currentTimeMillis());
            MessageNotificationWebSocket.sendAllInfo("你好呀！"+System.currentTimeMillis());
        }catch(Exception e){
            log.error(e.getMessage(),e);
        }
    }

}
